package sveta.applogic1;
import org.openqa.selenium.By;

import sveta.applogic.*;
import sveta.model.User;
import sveta.pages.*;

public class UserHelper1 extends DriverBasedHelper implements UserHelper{
	private ApplicationManager1 manager;
	public UserHelper1(ApplicationManager1 manager){
		super(manager.getWebDriver());
		this.manager = manager; 
	}
	@Override
	public void loginAs(User user) {
		pages.loginPage.setUsernameField(user.getLogin())
	      .setPasswordField(user.getPassword())
	      .clickSubmitButton();
	}
	
	@Override
	public boolean isLoggedIn() {
		//return driver.findElements(By.cssSelector("nav")).size() > 0;
		return pages.internalPage.waitPageLoaded();
	}

}
